package com.gexiaobao.pigeon.ui.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.gexiaobao.pigeon.R
import com.gexiaobao.pigeon.app.base.DataBindBaseViewHolder
import com.gexiaobao.pigeon.app.model.bean.BloodPigeonListBean
import com.gexiaobao.pigeon.databinding.ItemBloodPigeonSelectionBinding

/**
 * @Author      : hxw
 * @Date        : 2024/9/3 15:54
 * @Describe    :
 */
class AdapterBloodPigeonSelection(data: ArrayList<BloodPigeonListBean>) :
    BaseQuickAdapter<BloodPigeonListBean, DataBindBaseViewHolder>(R.layout.item_blood_pigeon_selection, data) {
    override fun convert(holder: DataBindBaseViewHolder, item: BloodPigeonListBean) {
        val binding = DataBindBaseViewHolder.getBinding(holder) as ItemBloodPigeonSelectionBinding
        binding.data = item
        binding.executePendingBindings()//防止列表抖动

        if (item.sex == "雌") {
            holder.setImageResource(R.id.ivItemSex, R.mipmap.icon_female)
        } else {
            holder.setImageResource(R.id.ivItemSex, R.mipmap.icon_male)
        }
    }
}